﻿<UserControl x:Class="MyVideoViewerManager.TrailersControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200" />
                <ColumnDefinition Width="3" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>        
            
            <StackPanel Orientation="Horizontal">
                <TextBlock Margin="3" Text="Order By:" />
                <RadioButton Margin="3" x:Name="rad1" Content="Name" />
                <RadioButton Margin="3" x:Name="rad2" Content="Newest" IsChecked="True" />
            </StackPanel>

            <ListBox Grid.Row="1" x:Name="trailersListBox" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                <ListBox.ItemTemplate>
                    <DataTemplate>

                        <Grid>

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="75" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Image Grid.Column="0" Margin="3" Source="{Binding PosterLocation}" />
                            <TextBlock Grid.Column="1" Margin="3" Text="{Binding Title}" FontWeight="Bold" TextWrapping="Wrap" />
                        </Grid>

                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            <GridSplitter Grid.Row="1" Grid.Column="1" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  />
            <ScrollViewer Grid.Row="1" Grid.Column="2" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
                <Grid x:Name="trailerGrid" Visibility="Collapsed">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="300" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <Image Grid.Column="0" Margin="10" Source="{Binding PosterLocation}" VerticalAlignment="Top"  />

                    <Grid Grid.Column="1" Grid.RowSpan="2">

                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <TextBlock Grid.Column="1" Margin="3" Text="{Binding Title}" FontWeight="Bold" FontSize="30"  TextWrapping="Wrap" />

                        <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="1">
                            <TextBlock Margin="3" Text="Post Date:" FontWeight="Bold" />
                            <TextBlock Margin="3" Text="{Binding PostDate,StringFormat='\{0:d\}'}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="2">
                            <TextBlock Margin="3" Text="Release Date:" FontWeight="Bold" />
                            <TextBlock Margin="3" Text="{Binding ReleaseDate,StringFormat='\{0:d\}'}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="3">
                            <TextBlock Margin="3" Text="Runtime:" FontWeight="Bold" />
                            <TextBlock Margin="3" Text="{Binding Runtime}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="4">
                            <TextBlock Margin="3" Text="Rating:" FontWeight="Bold" />
                            <TextBlock Margin="3" Text="{Binding Rating.RatingDesc}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="5">
                            <TextBlock Margin="3" Text="Studio:" FontWeight="Bold" />
                            <TextBlock Margin="3" Text="{Binding Studio.Name}" />
                        </StackPanel>

                        <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="6">
                            <TextBlock Margin="3" Text="Director:" FontWeight="Bold" />
                            <TextBlock Margin="3" Text="{Binding Director.PersonName}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="7">
                            <TextBlock Margin="3" Text="Genre:" FontWeight="Bold" />
                            <TextBlock Margin="3" x:Name="genreTextBlock" TextWrapping="Wrap" />
                        </StackPanel>
                        <Grid Grid.Column="1" Grid.Row="8">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <TextBlock Margin="3" Text="Cast:" FontWeight="Bold" />
                            <TextBlock Grid.Column="1" Margin="3" x:Name="castTextBlock" TextWrapping="Wrap" />
                        </Grid>
                        <TextBlock Grid.Row="9" Margin="3,6,3,3" Text="{Binding Description}" TextWrapping="Wrap" />
                    </Grid>

                    <Grid Grid.Row="1" Grid.Column="0" Margin="10">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        
                        <TextBlock Text="Files:" FontWeight="Bold" />
                        <ItemsControl Grid.Row="1" x:Name="filesListbox" >
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Tag="{Binding}" Width="Auto" Text="{Binding Name}" TextDecorations="Underline" Foreground="Blue" Cursor="Hand" MouseLeftButtonUp="TextBlock_MouseLeftButtonUp" />
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </Grid>


                </Grid>
            </ScrollViewer>
        </Grid>
    </Grid>
</UserControl>
